package com.danieldura.highrise.data
{
	public class InstantMessenger implements HighriseData
	{
		public static const PROTOCOL_AIM:String = "AIM";
		public static const PROTOCOL_MSN:String = "MSN";
		public static const PROTOCOL_ICQ:String = "ICQ";
		public static const PROTOCOL_JABBER:String = "Jabber";
		public static const PROTOCOL_YAHOO:String = "Yahoo";
		public static const PROTOCOL_SKYPE:String = "Skype";
		public static const PROTOCOL_QQ:String = "QQ";
		public static const PROTOCOL_SAMETIME:String = "Sametime";
		public static const PROTOCOL_GADUGADU:String = "Gadu-Gadu";
		public static const PROTOCOL_GOOGLETALK:String = "Google Talk";
		public static const PROTOCOL_OTHER:String = "other";
		
		public var id:int;
		public var address:String;
		public var protocol:String;
		public var location:String;
		
		public function parse( data:XML ):void
		{
			id = data.id;
			address = data.address;
			protocol = data.protocol;
			location = data.location;
		}
		
		public function toXML():XML
		{
			var data:XML = new XML( "<instant-messenger></instant-messenger>" );
			data.id = id;
			data.address = address;
			data.protocol = protocol;
			data.location = location;
			return data;
		}
		
		public function toXMLString():String
		{
			return toXML().toXMLString();
		}
				
	}
}

/*
    <instant-messenger>
      <id type="integer">1</id>
      <address>example</address>
      <protocol>#{ 
        AIM || MSN || ICQ || Jabber || Yahoo || Skype || QQ ||
        Sametime || Gadu-Gadu || Google Talk || other
      }</protocol>
      <location>#{ Work || Personal || Other }</location>
    </instant-messenger>
*/